@extends('admin.layouts.index')
@section('title', '解决方案列表')

@section('content')

<div class="row" style="margin-bottom:50px;float: left;width: 100%;">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <div class="card-title">文档列表</div>
                @if(Auth::user()->authority == 3)
                <a href="{{ url('/admin/documents/documents_add') }}" class="btn btn-primary btn-xs pull-right" style="margin-top: -30px;"><i class="iconfont icon-weibiaoti37" style="font-size: 12px;margin-right: 5px;"></i>添加文档</a>
                @endif
            </div>
            <div class="card-body">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th scope="col">标题</th>
                            <th scope="col">会员查看</th>
                            <th scope="col">状态</th>
                            <th scope="col">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($menus as $menu)
                            @if($menu["authority"] == 1 || Auth::user()->authority == 3)
                            <tr><th colspan="4">{{ $menu["title"] }}</td></th>
                            @endif
                            @foreach($menu["childs"] as $child)
                            @if($child["authority"] == 1 || Auth::user()->authority == 3)
                            <tr>
                                <td>|- {{ $child["title"] }}</td>
                                @if($child["product_id"] <= 1)
                                <td class="text-success">不需要</td>
                                @else
                                <td class="text-danger">需要</td>
                                @endif

                                @if($child["disable"] == 1)
                                <td class="text-success">可用</td>
                                @else
                                <td class="text-danger">已禁用</td>
                                @endif
                                <td>
                                    <a href="{{ url('/admin/documents/documents_detail',['id'=>$child['id']]) }}" target="_blank">预览文档</a>
                                    @if(Auth::user()->authority == 3) ｜ <a href="{{ url('/admin/documents/documents_update',['id'=>$child['id']]) }}">更新文档</a> 
                                    @endif
                                </td>
                            </tr>
                            @endif
                            @endforeach
                        @endforeach


                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

@endsection
